home *** CD-ROM | disk | FTP | other *** search
- function ShowMessage(abduction)
- {
- if(abduction)
- {
- _root.message.gotoAndStop(2);
- }
- else
- {
- var remove = true;
- var i = 1;
- while(i < 10)
- {
- if(eval("_root.ship_" + i).action == 2)
- {
- remove = false;
- i = 10;
- }
- i++;
- }
- if(remove)
- {
- _root.message.gotoAndStop(1);
- }
- }
- }
- function CheckLevelFin()
- {
- var _loc1_ = _root;
- _loc1_.enemies_on -= 1;
- _loc1_.enemies_to_kill = _loc1_.enemies_to_kill != 0 ? --_loc1_.enemies_to_kill : 0;
- if(_loc1_.enemies_on <= 0 && _loc1_.enemies_to_kill <= 0)
- {
- _loc1_.ship_0.turbine.stop();
- _loc1_.gotoAndPlay("next_level");
- }
- }
- function ExtraBomb()
- {
- var _loc1_ = _root;
- var _loc2_ = Math.floor(_loc1_.score / _loc1_.extra_bombs);
- if(_loc2_ + 1 >= _loc1_.score / _loc1_.extra_bombs && !_loc1_.ex_bomb_array[_loc2_])
- {
- _loc1_.ex_bomb_array[_loc2_] = true;
- _loc1_.smartbombs += 1;
- if(_loc1_.sound_on)
- {
- _loc1_.extra_life_sfx.start(0,1);
- }
- }
- }
- function ExtraLife()
- {
- var _loc1_ = _root;
- var _loc2_ = Math.floor(_loc1_.score / _loc1_.extra_points);
- if(_loc2_ + 1 >= _loc1_.score / _loc1_.extra_points && !_loc1_.ex_lives_array[_loc2_])
- {
- _loc1_.ex_lives_array[_loc2_] = true;
- _loc1_.lives += 1;
- if(_loc1_.sound_on)
- {
- _loc1_.extra_life_sfx.start(0,1);
- }
- }
- }
- function RemoveAll()
- {
- var s = 0;
- while(s < 21)
- {
- removeMovieClip(eval("_root.comp_" + s));
- removeMovieClip(eval("_root.ship_" + s));
- removeMovieClip(eval("_root.shot_" + s));
- removeMovieClip(eval("_root.ensh_" + s));
- removeMovieClip(eval("_root.man_" + s));
- removeMovieClip(eval("_root.b_" + s));
- removeMovieClip(eval("_root.mine_" + s));
- s++;
- }
- _root.ship_speed = 0;
- _root.colTrans = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
- _root.bigBangColor.setTransform(_root.colTrans);
- }
- function PlanetDestroy()
- {
- var s = 1;
- while(s < 10)
- {
- eval("_root.main_backgr.star_" + s)._y = 70 + Math.random() * 290;
- s++;
- }
- _root.globalBang = 30;
- _root.planet_destroyed = true;
- _root.mountain._visible = false;
- _root.radar_1._visible = false;
- _root.radar_2._visible = false;
- var i = 0;
- while(i < 6)
- {
- _root.AttachBang(Math.random() * 400 + 75,Math.random() * 250 + 100);
- i++;
- }
- }
- function LevelInit()
- {
- var _loc1_ = _root;
- _loc1_.level += 1;
- _loc1_.EnemyAr = new Array(false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
- _loc1_.enemy_shots = 0;
- _loc1_.bangs_count = 0;
- _loc1_.mines_count = 0;
- _loc1_.score_counter = 0;
- _loc1_.ship_x = 0;
- _loc1_.ship_speed = 0;
- _loc1_.baiters_time = 800;
- _loc1_.enemies_on = 0;
- _loc1_.player_on = false;
- _loc1_.hyperspace = false;
- _loc1_.globalBang = 0;
- _loc1_.EnemyAttach(0,false,275,210);
- _loc1_.timer_enemy = 20;
- _loc1_.enemies_to_kill = (_loc1_.level - 1) * 5 + 15;
- _loc1_.paused = false;
- }
- function GameInit()
- {
- var _loc1_ = _root;
- _loc1_.track_play = false;
- _loc1_.splash_music.stop();
- _loc1_.pick_up_man = 0.9;
- _loc1_.enemy_speed = 1;
- _loc1_.en_shooting = 1;
- _loc1_.planet_destroyed = false;
- _loc1_.max_speed = 24;
- _loc1_.x_dimension = 2357.6;
- _loc1_.smartbombs = 3;
- _loc1_.lives = 3;
- _loc1_.score = 0;
- _loc1_.level = 0;
- _loc1_.AstroAr = new Array(true,true,true,true,true,true,true,true,true,true,true);
- _loc1_.ex_lives_array = new Array(true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
- _loc1_.ex_bomb_array = new Array(true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
- _loc1_.max_astronauts = 11;
- }
- function Scoring(x, y, score_inc)
- {
- var _loc1_ = _root;
- _loc1_.score += score_inc;
- _loc1_.bubble = attachMovie("score_bubble","sc_b_" + _loc1_.score_counter,_loc1_.score_counter + 70);
- _loc1_.bubble._x = x;
- _loc1_.bubble._y = y;
- _loc1_.bubble.score = score_inc;
- _loc1_.score_counter += 1;
- if(_loc1_.score_counter == 10)
- {
- _loc1_.score_counter = 0;
- }
- _loc1_.ExtraLife();
- _loc1_.ExtraBomb();
- }
- function RemoveAmmo()
- {
- _root.colTrans = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
- _root.bigBangColor.setTransform(_root.colTrans);
- var a = 1;
- while(a < 20)
- {
- removeMovieClip(eval("_root.ensh_" + a));
- removeMovieClip(eval("_root.mine_" + a));
- a++;
- }
- var a = 1;
- while(a < 16)
- {
- var man = eval("_root.man_" + a);
- man._y = 370;
- man.action = 0;
- var ship = eval("_root.ship_" + a);
- if(ship.action > 0)
- {
- ship.action = 0;
- }
- var dx = Math.random() >= 0.5 ? Math.random() * 300 + 1000 : (- Math.random()) * 300 - 500;
- var x = _root.ToNewX(0,dx);
- ship.x = x;
- ship._y = Math.random() * 100 + 100;
- ship._x = 1000;
- a++;
- }
- }
- function PlBang()
- {
- }
- function PlayerHitted()
- {
- var _loc1_ = _root;
- if(_loc1_.player_on && !_loc1_.hyperspace)
- {
- _loc1_.player_on = false;
- _loc1_.ship_speed = 0;
- _loc1_.message.gotoAndStop(1);
- _loc1_.attachMovie("player_bang","player_bang",5);
- _loc1_.player_bang._x = _loc1_.ship_0._x;
- _loc1_.player_bang._y = _loc1_.ship_0._y;
- _loc1_.ship_0._y = 210;
- _loc1_.ship_0._x = 275;
- _loc1_.ship_0.dy = 0;
- if(_loc1_.sound_on)
- {
- _loc1_.smart_sfx.start(0,1);
- }
- _loc1_.lives -= 1;
- if(_loc1_.lives == 0)
- {
- delete _loc1_.onEnterFrame;
- _loc1_.ship_0.turbine.stop();
- _loc1_.gotoAndPlay("game_over");
- }
- }
- }
- function AttachBang(x, y)
- {
- if(_root.sound_on)
- {
- _root.blast_sfx.start(0,1);
- }
- _root.attachMovie("bang","b_" + _root.bangs_count,_root.bangs_count + 100);
- eval("_root.b_" + _root.bangs_count)._x = x;
- eval("_root.b_" + _root.bangs_count)._y = y;
- _root.bangs_count += 1;
- if(_root.bangs_count > 19)
- {
- _root.bangs_count = 0;
- }
- }
- function AttachOnLevel(level)
- {
- var _loc1_ = _root;
- var _loc2_ = Math.random();
- switch(level)
- {
- case 0:
- _loc1_.EnemyAttach(3,true);
- break;
- case 1:
- if(!_loc1_.planet_destroyed)
- {
- _loc1_.EnemyAttach(1,true);
- }
- else
- {
- _loc1_.EnemyAttach(2,true);
- }
- break;
- case 2:
- if(_loc2_ < 0.7)
- {
- if(!_loc1_.planet_destroyed)
- {
- _loc1_.EnemyAttach(1,true);
- }
- else
- {
- _loc1_.EnemyAttach(2,true);
- }
- }
- else
- {
- _loc1_.EnemyAttach(4,true);
- }
- break;
- case 3:
- case 4:
- if(_loc2_ < 0.7)
- {
- if(!_loc1_.planet_destroyed)
- {
- _loc1_.EnemyAttach(1,true);
- }
- else
- {
- _loc1_.EnemyAttach(2,true);
- }
- }
- else if(_loc2_ < 0.85)
- {
- _loc1_.EnemyAttach(4,true);
- }
- else
- {
- _loc1_.EnemyAttach(5,true);
- }
- break;
- default:
- if(_loc2_ < 0.6)
- {
- if(!_loc1_.planet_destroyed)
- {
- _loc1_.EnemyAttach(1,true);
- }
- else
- {
- _loc1_.EnemyAttach(2,true);
- }
- }
- else if(_loc2_ < 0.75)
- {
- _loc1_.EnemyAttach(4,true);
- }
- else if(_loc2_ < 0.9)
- {
- _loc1_.EnemyAttach(5,true);
- }
- else
- {
- _loc1_.EnemyAttach(3,true);
- }
- }
- }
- function Mine()
- {
- }
- function EnemyAttach(type_enemy, randomly, x, y)
- {
- if(type_enemy == 0)
- {
- _root.locator.ship_0._visible = false;
- _root.attachMovie("compile","comp_" + j,50 + j);
- eval("_root.comp_" + j).type_enemy = type_enemy;
- eval("_root.comp_" + j).ship_index = j;
- eval("_root.comp_" + j).x = x;
- eval("_root.comp_" + j).y = y;
- }
- if(type_enemy > 0 && (_root.enemies_to_kill > 0 || type_enemy == 2 && !_root.planet_destroyed))
- {
- var j = 1;
- while(j < _root.max_enemies + 1)
- {
- if(!_root.EnemyAr[j])
- {
- _root.EnemyAr[j] = true;
- _root.attachMovie("compile","comp_" + j,50 + j);
- eval("_root.comp_" + j).type_enemy = type_enemy;
- eval("_root.comp_" + j).ship_index = j;
- if(randomly)
- {
- eval("_root.comp_" + j).x = -10;
- }
- else
- {
- eval("_root.comp_" + j).x = x;
- eval("_root.comp_" + j).y = y;
- }
- j = 20;
- }
- j++;
- }
- }
- }
- function Compile()
- {
- }
- function CompilePart()
- {
- }
- function EnShooting(x, y, screen_x)
- {
- if(screen_x > -10 && screen_x < 560)
- {
- if(_root.sound_on)
- {
- _root.en_shot_sfx.start(0,1);
- }
- _root.attachMovie("enemy_shot","ensh_" + _root.enemy_shots,_root.enemy_shots + 5000);
- this.shoot = eval("_root.ensh_" + _root.enemy_shots);
- this.shoot.x = x;
- this.shoot._y = y;
- this.ang = Math.atan2(_root.ship_0._y - y,_root.ship_0._x - screen_x);
- this.shoot.dx = 5 * Math.cos(this.ang);
- this.shoot.dy = 5 * Math.sin(this.ang);
- _root.enemy_shots += 1;
- if(_root.enemy_shots == 20)
- {
- _root.enemy_shots = 0;
- }
- }
- }
- function EnShot()
- {
- }
- function Bang()
- {
- }
- function BangPart()
- {
- }
- function PlShot()
- {
- }
- function SingleStar()
- {
- }
- PlBang.prototype = new MovieClip();
- PlBang.prototype.onLoad = function()
- {
- _root.locator.ship_0._visible = false;
- _root.globalBang = 110;
- var j = 1;
- while(j < 10)
- {
- this.attachMovie("bang_part","bp_" + j,j);
- if(eval("_root.comp_" + j) != undefined)
- {
- _root.EnemyAr[j] = false;
- removeMovieClip(eval("_root.comp_" + j));
- }
- j++;
- }
- };
- PlBang.prototype.onEnterFrame = function()
- {
- this._alpha -= 4;
- };
- Object.registerClass("player_bang",PlBang);
- Mine.prototype = new MovieClip();
- Mine.prototype.onEnterFrame = function()
- {
- var _loc1_ = this;
- var _loc2_ = _root;
- if(!_loc2_.paused)
- {
- if(_loc1_.hitTest(_loc2_.ship_0))
- {
- _loc2_.PlayerHitted();
- }
- _loc1_.x = _loc2_.ToNewX(_loc1_.x,0);
- _loc1_._x = _loc2_.ToGlobal(_loc1_.x);
- }
- };
- Object.registerClass("mine",Mine);
- Compile.prototype = new MovieClip();
- Compile.prototype.onLoad = function()
- {
- var _loc1_ = this;
- var _loc2_ = _root;
- if(_loc1_.x < 0)
- {
- _loc1_.x = Math.random() * _loc2_.x_dimension;
- _loc1_._y = Math.random() * 100 + 100;
- }
- else
- {
- _loc1_._y = _loc1_.y;
- }
- _loc1_._alpha = 0;
- j = 1;
- while(j < 4)
- {
- _loc1_.attachMovie("compile_part","cp_" + j,j);
- j++;
- }
- if(_loc2_.ToGlobal(_loc1_.x) < 560 && _loc2_.sound_on)
- {
- _loc2_.ship_appear.start(0,1);
- }
- };
- Compile.prototype.onEnterFrame = function()
- {
- var _loc1_ = this;
- _loc1_.x = _root.ToNewX(_loc1_.x,0);
- _loc1_._x = _root.ToGlobal(_loc1_.x);
- _loc1_._alpha += 5;
- };
- Object.registerClass("compile",Compile);
- CompilePart.prototype = new MovieClip();
- CompilePart.prototype.onLoad = function()
- {
- var _loc1_ = this;
- _loc1_.rad = Math.random() * 30 + 90;
- _loc1_.ang = Math.random() * 6.28;
- _loc1_._x = Math.cos(_loc1_.ang) * _loc1_.rad;
- _loc1_._y = Math.sin(_loc1_.ang) * _loc1_.rad;
- _loc1_.dv = Math.random() * 8 + 16;
- };
- CompilePart.prototype.onEnterFrame = function()
- {
- var _loc1_ = this;
- if(!_root.paused)
- {
- _loc1_.dx = _loc1_._x;
- _loc1_.dy = _loc1_._y;
- _loc1_._x -= _loc1_.dx / _loc1_.dv;
- _loc1_._y -= _loc1_.dy / _loc1_.dv;
- }
- };
- Object.registerClass("compile_part",CompilePart);
- EnShot.prototype = new MovieClip();
- EnShot.prototype.onEnterFrame = function()
- {
- var _loc1_ = this;
- var _loc2_ = _root;
- if(!_loc2_.paused)
- {
- if(_loc2_.ship_0.hot_spot.hitTest(_loc1_._x,_loc1_._y,true))
- {
- _loc2_.PlayerHitted();
- }
- _loc1_.x = _loc2_.ToNewX(_loc1_.x,_loc1_.dx * _loc2_.en_shot_speed);
- _loc1_._x = _loc2_.ToGlobal(_loc1_.x);
- _loc1_._y += _loc1_.dy * _loc2_.en_shot_speed;
- if(_loc1_._x > 600 || _loc1_._x < -50 || _loc1_._y > 410 || _loc1_._y < 60)
- {
- removeMovieClip(_loc1_);
- }
- }
- };
- Object.registerClass("enemy_shot",EnShot);
- Bang.prototype = new MovieClip();
- Bang.prototype.onLoad = function()
- {
- var _loc2_ = this;
- var _loc1_ = 1;
- while(_loc1_ < 5)
- {
- _loc2_.attachMovie("bang_part","bp_" + _loc1_,_loc1_);
- _loc1_ = _loc1_ + 1;
- }
- };
- Bang.prototype.onEnterFrame = function()
- {
- this._x -= _root.ship_speed;
- this._alpha -= 4;
- };
- Object.registerClass("bang",Bang);
- BangPart.prototype = new MovieClip();
- BangPart.prototype.onLoad = function()
- {
- var _loc1_ = this;
- _loc1_.rad = Math.random() * 8 + 8;
- _loc1_.ang = Math.random() * 6.28;
- _loc1_.dx = Math.cos(_loc1_.ang) * _loc1_.rad;
- _loc1_.dy = Math.sin(_loc1_.ang) * _loc1_.rad;
- };
- BangPart.prototype.onEnterFrame = function()
- {
- var _loc1_ = this;
- if(!_root.paused)
- {
- _loc1_._x += _loc1_.dx;
- _loc1_._y += _loc1_.dy;
- _loc1_.dx *= 0.9;
- _loc1_.dy = (_loc1_.dy + 0.3) * 0.9;
- }
- };
- Object.registerClass("bang_part",BangPart);
- PlShot.prototype = new MovieClip();
- PlShot.prototype.onLoad = function()
- {
- var _loc1_ = this;
- var _loc2_ = _root;
- _loc1_.clr = new Color(_loc1_);
- _loc1_.clr_trans = new Object();
- _loc1_.clr_trig = Math.floor(Math.random() * 4);
- switch(_loc1_.clr_trig)
- {
- case 0:
- _loc1_.clr.setRGB(65535);
- break;
- case 1:
- _loc1_.clr.setRGB(65280);
- break;
- case 2:
- _loc1_.clr.setRGB(16776960);
- break;
- case 3:
- _loc1_.clr.setRGB(16755455);
- }
- if(_loc2_.ship_0._xscale < 0)
- {
- _loc1_.dx = -30;
- }
- else
- {
- _loc1_.dx = 30;
- }
- _loc1_._x = _loc2_.ship_0._x - _loc1_.dx;
- _loc1_._y = _loc2_.ship_0._y;
- _loc1_._xscale = 0;
- };
- PlShot.prototype.onEnterFrame = function()
- {
- if(!_root.paused)
- {
- var i = 1;
- while(i < 16)
- {
- this.ship = eval("_root.ship_" + i);
- if(this.hitTest(this.ship))
- {
- this.ship.Destroy(false);
- _root.EnemyAr[i] = false;
- removeMovieClip(this);
- }
- this.man = eval("_root.man_" + i);
- if(this.hitTest(this.man))
- {
- this.man.Destroy();
- removeMovieClip(this);
- }
- i++;
- }
- this._x += this.dx;
- if(this._x > 600 || this._x < -50)
- {
- removeMovieClip(this);
- }
- if(this._width <= 100)
- {
- this._xscale += this.dx;
- }
- }
- };
- Object.registerClass("player_shot",PlShot);
- ToNewX = function(x, dx)
- {
- var _loc2_ = _root;
- var _loc1_ = x + dx;
- if(_loc1_ < 0)
- {
- _loc1_ = _loc2_.x_dimension + _loc1_;
- }
- if(_loc1_ > _loc2_.x_dimension)
- {
- _loc1_ -= _loc2_.x_dimension;
- }
- return _loc1_;
- };
- ToGlobal = function(local_x)
- {
- var _loc1_ = - _root.ship_x + local_x;
- if(_loc1_ < 0)
- {
- var _loc2_ = _root.x_dimension + _loc1_;
- }
- else
- {
- _loc2_ = _loc1_;
- }
- return _loc2_;
- };
- ToRadarCoords = function(local_x)
- {
- var _loc3_ = _root;
- var _loc1_ = (- _loc3_.ship_x + local_x) / 10 + 245;
- if(_loc1_ < 157)
- {
- var _loc2_ = _loc3_.x_dimension / 10 + _loc1_;
- }
- else if(_loc1_ > 393)
- {
- _loc2_ = (- _loc3_.x_dimension) / 10 + _loc1_;
- }
- else
- {
- _loc2_ = _loc1_;
- }
- return _loc2_;
- };
- SingleStar.prototype = new MovieClip();
- SingleStar.prototype.onLoad = function()
- {
- var _loc1_ = this;
- _loc1_.gotoAndStop(Math.floor(Math.random() * 5 + 1));
- _loc1_.ax = Math.random() + 1.2;
- _loc1_._y = Math.random() * 170 + 70;
- _loc1_._x = Math.random() * 500 + 25;
- };
- SingleStar.prototype.onEnterFrame = function()
- {
- var _loc1_ = this;
- if(!_root.paused)
- {
- _loc1_._x -= _loc1_.ax * _root.ship_speed / 16;
- if(_loc1_._x > 560)
- {
- _loc1_._x = -5;
- }
- if(_loc1_._x < -10)
- {
- _loc1_._x = 555;
- }
- }
- };
- Object.registerClass("star",SingleStar);
-